﻿//============================================================
// 自动生成的代码
// 模块名:      用户访问会话日志 模型类
// 版本:        1.0   
// 生成时间:    2025/2/10 17:31:28
// 说明：为全自动产生，包含表名前缀
//============================================================

using SqlSugar;

namespace Common.Model
{
    /// <summary>
    /// 用户访问会话日志 模型类
    /// </summary>
    [Serializable()]
    [SugarTable("User_Session_Log")]
    public partial class UserSessionLogModel
    {
        #region 私有变量

        /// <summary>
        /// 保存值有变化的属性名
        /// </summary>
        private List<string> _changeProperty = null;

        //对象是否初始化完，初始化完后再做信息修改,ChangeProperty列表记录修改的属性名
        private bool _isInitOK = false;

        //主键   
        private long? _ID;

        // 用户ID
        private long? _UserID = 0;
        // 会话ID
        private long? _SessionID = 0;
        // 创建时间
        private DateTime? _CreateTime = DateTime.MinValue;
        // 更新时间
        private DateTime? _UpdateTime = DateTime.MinValue;
        // 是否已废弃  Y，是  N，否
        private string _DeleteFlag = String.Empty;
        // 废弃时间
        private DateTime? _DeleteTime = DateTime.MinValue;

        #endregion

        #region 公共属性

        /// <summary>
        /// 对象是否初始化完，初始化完后再做信息修改,ChangeProperty列表记录修改的属性名
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool IsInitOK
        {
            get
            {
                return _isInitOK;
            }
            set
            {
                _isInitOK = value;
                if (value && _changeProperty == null)
                {
                    _changeProperty = new List<string>();
                }
            }
        }

        /// <summary>
        /// 记录修改内容的属性名
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<string> ChangeProperty
        {
            get { return this._changeProperty; }
            set
            {
                if (this._changeProperty != value)
                {
                    this._changeProperty = value;
                }
            }
        }

        /// <summary>
        /// 主键  
        /// </summary>
        [SugarColumn(ColumnName = "ID", IsPrimaryKey = true, IsNullable = false, Length = 0, IsIdentity = false, ColumnDescription = "")]
        public long? ID
        {
            get { return this._ID; }
            set
            {
                if (this._ID != value)
                {
                    this._ID = value;
                    OnChanged("ID");
                }
            }
        }

        /// <summary>
        /// 用户ID
        /// </summary>
        [SugarColumn(ColumnName = "UserID", IsPrimaryKey = false, IsNullable = false, Length = 0, IsIdentity = false, ColumnDescription = "用户ID")]
        public long? UserID
        {
            get { return this._UserID; }
            set
            {
                if (this._UserID != value)
                {
                    this._UserID = value;
                    OnChanged("UserID");
                }
            }
        }

        /// <summary>
        /// 会话ID
        /// </summary>
        [SugarColumn(ColumnName = "SessionID", IsPrimaryKey = false, IsNullable = false, Length = 0, IsIdentity = false, ColumnDescription = "会话ID")]
        public long? SessionID
        {
            get { return this._SessionID; }
            set
            {
                if (this._SessionID != value)
                {
                    this._SessionID = value;
                    OnChanged("SessionID");
                }
            }
        }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "CreateTime", IsPrimaryKey = false, IsNullable = false, Length = 0, IsIdentity = false, ColumnDescription = "创建时间")]
        public DateTime? CreateTime
        {
            get { return this._CreateTime; }
            set
            {
                if (this._CreateTime != value)
                {
                    this._CreateTime = value;
                    OnChanged("CreateTime");
                }
            }
        }

        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(ColumnName = "UpdateTime", IsPrimaryKey = false, IsNullable = false, Length = 0, IsIdentity = false, ColumnDescription = "更新时间")]
        public DateTime? UpdateTime
        {
            get { return this._UpdateTime; }
            set
            {
                if (this._UpdateTime != value)
                {
                    this._UpdateTime = value;
                    OnChanged("UpdateTime");
                }
            }
        }

        /// <summary>
        /// 是否已废弃  Y，是  N，否
        /// </summary>
        [SugarColumn(ColumnName = "DeleteFlag", IsPrimaryKey = false, IsNullable = false, Length = 1, IsIdentity = false, ColumnDescription = "是否已废弃  Y，是  N，否")]
        public string DeleteFlag
        {
            get { return this._DeleteFlag; }
            set
            {
                if (this._DeleteFlag != value)
                {
                    this._DeleteFlag = value;
                    OnChanged("DeleteFlag");
                }
            }
        }

        /// <summary>
        /// 废弃时间
        /// </summary>
        [SugarColumn(ColumnName = "DeleteTime", IsPrimaryKey = false, IsNullable = false, Length = 0, IsIdentity = false, ColumnDescription = "废弃时间")]
        public DateTime? DeleteTime
        {
            get { return this._DeleteTime; }
            set
            {
                if (this._DeleteTime != value)
                {
                    this._DeleteTime = value;
                    OnChanged("DeleteTime");
                }
            }
        }


        #endregion

        #region 方法

        /// <summary>
        /// 修改属性值事件，记录值变化的属性名
        /// </summary>
        /// <param name="propertyName">属性名</param>
        private void OnChanged(string propertyName)
        {
            if (IsInitOK)
            {
                if (_changeProperty == null)
                {
                    _changeProperty = new List<string>();
                }
                if (_changeProperty.IndexOf(propertyName) < 0)
                {
                    _changeProperty.Add(propertyName);
                }
            }
        }

        #endregion
    }
}